<template>
	<view style="height:calc(100vh - 50px);" :style="[AppSkinVar]">
		<ClassifyCard index="tabbarClassifyCard" @endRefresh="stopDownRefresh"></ClassifyCard>
	</view>
</template>

<script setup lang="ts">
import ClassifyCard from './child/classify/index.vue';
import { onReady, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import customTabbar from './utils/customTabbar';
import { useI18n } from 'vue-i18n';
import { TABBAR_TXTS } from '@/env';
import { useInit } from '@/common/stores';
import { storeToRefs } from 'pinia';

const { tabbarData, tabbarPageIndex } = storeToRefs(useInit());

const { t } = useI18n();
const stopDownRefresh = () => {
		// 停止下拉动作
		uni.stopPullDownRefresh()
	}
onReady(() => {
	const title = tabbarData.value[tabbarPageIndex.value].text;
	uni.setNavigationBarTitle({
		title: TABBAR_TXTS.includes(title) ? t(`tabbar.${title}`) : title
	});
});

onShow(() => {
	customTabbar.onShow('tabbarClassifyCard');
});
onReachBottom(() => {
	customTabbar.onReachBottom('tabbarClassifyCard');
});
onPullDownRefresh(() => {
	customTabbar.onPullDownRefresh('tabbarClassifyCard');
});
</script>

<style></style>
